Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

control/server.py: support --cpumask=0xF #867

Merged
merged 1 commit into from
Sep 15, 2024
Merged

Conversation

baum
Copy link
Collaborator

@baum baum commented Sep 12, 2024

control/server.py: support --cpumask=0xF

The spdk argument defined here - https://github.com/ceph/spdk/blob/0d9430fab9b368761b13dc73a65b0ed13d6c6bc6/lib/event/app.c#L97-L98

The getopt_long option expects a required argument (indicated by required_argument).
The option can be passed in two forms:

  • Long option: --cpumask 0xF or --cpumask=0xF
  • Short option: -m 0xF

A sample test code to test valid/parsable command line variants for -m//--cpumask:

#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>

#define CPUMASK_OPT_IDX 'm'

int main(int argc, char *argv[]) {
    int option;
    char *cpumask_value = NULL;

    // Define the long options
    static struct option long_options[] = {
        {"cpumask", required_argument, NULL, CPUMASK_OPT_IDX},
        {0, 0, 0, 0}
    };

    // Parse the command-line options
    while ((option = getopt_long(argc, argv, "m:", long_options, NULL)) != -1) {
        switch (option) {
            case CPUMASK_OPT_IDX:
                cpumask_value = optarg;  // Get the cpumask argument value
                printf("cpumask option value: %s\n", cpumask_value);
                break;
            case '?':  // Invalid option
                printf("Unknown option!\n");
                return 1;
            default:
                printf("Usage: %s -m <value> or --cpumask=<value>\n", argv[0]);
                return 1;
        }
    }

    if (cpumask_value) {
        printf("Successfully parsed cpumask: %s\n", cpumask_value);
    } else {
        printf("cpumask argument was not provided.\n");
    }

    return 0;
}

control/server.py Show resolved Hide resolved
control/server.py Show resolved Hide resolved
@baum baum changed the title control/server.py: support --cpumask=0xF / -m=0xF control/server.py: support --cpumask=0xF Sep 12, 2024
@baum baum force-pushed the cpumask_syntax branch 2 times, most recently from b040814 to 654b381 Compare September 12, 2024 14:20
- ceph#866

Signed-off-by: Alexander Indenbaum <aindenba@redhat.com>
@gbregman gbregman linked an issue Sep 12, 2024 that may be closed by this pull request
control/server.py Show resolved Hide resolved
control/server.py Show resolved Hide resolved
control/server.py Show resolved Hide resolved
@baum baum merged commit 8814252 into ceph:devel Sep 15, 2024
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

SPDK CPU auto detect code has issues
2 participants